package stream;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Client {
    public static void main(String[] args) {
        List<Student> students = new ArrayList<>();
        students.add(new Student("9", "aaa", "男"));
        students.add(new Student("2", "bbb", "女"));
        students.add(new Student("1", "bbb", "女"));
        students.add(new Student("5", "bbb", "女"));
        students.add(new Student("3", "bbb", "女"));

        List<User> copyUsers = students.stream()
                .map(s -> new User(s.getId(), s.getName())).collect(Collectors.toList());

        System.out.println(copyUsers);
    }
}

class Student {
    private String id;
    /**
     * 学生姓名
     */
    private String name;
    /**
     * 学生性别
     */
    private String gender;

    public Student(String id, String name, String gender) {
        this.id = id;
        this.name = name;
        this.gender = gender;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }
}


class User {
    private String uid;
    private String uname;

    public User(String uid, String uname) {
        this.uid = uid;
        this.uname = uname;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }
}